<?php
namespace app\common\validate;

use think\Validate;

class TeacherValidate extends Validate
{
    protected $rule =   [
        'id'                      => 'require|integer',
        'user_id|用户ID'          => 'require|integer',
        'hall_id|课堂ID'          => 'require|integer',
        'price|支付金额'          => 'require',
        'page|页数'               => 'require|integer',
        'limit|条数'              => 'require|integer',
        'type|类型'               => 'require|in:1,2',
        'status|状态'             => 'require|in:1,2,3',
        'name|昵称'               => 'require|length:1,50',
        'head_img|头像'           => 'require|image',
    ];
    
    protected $scene = [
        /** api */
        'list'      => ['page', 'limit'],
        'sign'      => ['user_id', 'hall_id', 'price'],
        'hall_list' => ['user_id', 'type', 'status', 'page', 'limit'],
        'hall_show' => ['hall_id'],
        'student'   => ['user_id', 'hall_id', 'page', 'limit'],

        /** admin */
        'add'       => ['name', 'head_img'],
        'edit'      => ['id', 'name'],
        'edit_img'  => ['id', 'name', 'head_img'],
        'show'      => ['id'],
    ];
}